package com.jwtter.generator.utils;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @date 2017年6月14日
 * @author jinwt
 *
 */
public class LogUtil {
	private static Logger logger = Logger.getLogger(LogUtil.class.getName());;

	public LogUtil(Class<?> cla) {
		logger = Logger.getLogger(cla.getName());
	}
	/**
	 * 一般信息输出
	 * 
	 * @param msg
	 * @param thrown
	 */
	public static void info(String msg, Throwable thrown) {
		if (thrown != null) {
			logger.log(Level.INFO, msg, thrown);
		} else {
			info(msg);
		}
	}
	public static void info(String msg) {
		logger.log(Level.INFO, msg);
	}
	/**
	 * 异常日志输出
	 * 
	 * @param msg
	 * @param thrown
	 */
	public static void error(String msg, Throwable thrown) {
		if (thrown != null) {
			logger.log(Level.SEVERE, msg, thrown);
		} else {
			error(msg);
		}
	}
	public static void error(String msg) {
		logger.log(Level.SEVERE, msg);
	}

}
